sync --no-pull and --no-push affect download and upload of content
authorJoey Hess <joeyh@joeyh.name>
Tue, 16 May 2023 20:25:23 +0000 (16:25 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 16 May 2023 20:25:23 +0000 (16:25 -0400)
The man page is somewhat vague about this, but I do think it was a bug
that these options didn't alreay behave that way. The options are
documented to disable imports and exports, which is the same operations
just with a special remote that uses trees.

The real motivation for this is that I'm adding git-annex pull and
git-annex push, and I want these options to turn off the equivilant of
those commands. And git-annex pull will certianly download and push
upload.

Sponsored-by: Nicholas Golder-Manning on Patreon
CHANGELOG
Command/Sync.hs

index d4064e6059fe2b4ae0c5058e08496f23c80d5aa8..ec018fb3b2f6822985918fc25dc210e0aadf2d85 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -49,8 +49,10 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
   * reinject: Fix support for operating on multiple pairs of files and keys.
   * importfeed: Support -J
   * importfeed: Support --json-progress
-  * sync: Fix bug that made --no-pull, rather than --no-push prevent
-    exporting trees to special remotes.
+  * sync: Fix buggy handling of --no-pull and --no-push when syncing
+    --content. With --no-pull, avoid downloading content, and with
+    --no-push avoid uploading content. This was done before, but
+    inconsistently.
   * uninit: Avoid buffering the names of all annexed files in memory.
 
  -- Joey Hess <id@joeyh.name>  Sat, 08 Apr 2023 13:57:18 -0400
index 1a570a37800117f0b9ae0b9ff5d2c5e9f78f23ff..def9bef8fe7edc15819ee993a0d6a324c3c19f0c 100644 (file)
@@ -866,7 +866,8 @@ syncFile ebloom rs af k = do
        return (got || not (null putrs))
   where
        wantget have inhere = allM id 
-               [ pure (not $ null have)
+               [ pure (maybe True pullOption o)
+               , pure (not $ null have)
                , pure (not inhere)
                , wantGet True (Just k) af
                ]
@@ -879,6 +880,7 @@ syncFile ebloom rs af k = do
                        next $ return True
 
        wantput r
+               | pushOption o = Just False = return False
                | Remote.readonly r || remoteAnnexReadOnly (Remote.gitconfig r) = return False
                | isThirdPartyPopulated r = return False
                | otherwise = wantGetBy True (Just k) af (Remote.uuid r)